package Cantella::DJabberd::Model::Admin::User::Action::Login;

use Reaction::Class;

use Reaction::Types::Core qw/NonEmptySimpleStr Password/;

class Login, is 'Reaction::InterfaceModel::Action', which{

  has username  => ( is => 'rw', lazy_fail => 1 , isa => NonEmptySimpleStr);
  has password  => ( is => 'rw', lazy_fail => 1,  isa => Password);

  implements do_apply => as {
    my ($self) = @_;
    $self->ctx->log->debug("LOGIN / LOGOUT: " . join ", ", %{ $self->parameter_hashref } );
    return $self->target_model->login_user(%{ $self->parameter_hashref });
  };

};

1;
